local off,res,range = Vector3.new(0,10,40),.1,10 local wm = Instance.new("WorldModel",script) function trunc(n,d) return math.round(n*d)/d end function createPart(pos,re) local p = Instance.new("Part") p.Size = Vector3.one/(1/(re or res)) p.Anchored = true p.Position = off+Vector3.new(-pos.X,pos.Y,0) return p end local parts = {} function rend() for i,v in parts do v.Parent = wm end table.clear(parts) end function draw(func) for x=-range,range,res do for y=-range,range,res do local pos = Vector2.new(x,y) if func(pos) then table.insert(parts,createPart(pos)) end end end rend() end function reset() wm:ClearAllChildren() -- axees for y=-range*1.5,range*1.5,.05 do local p = createPart(Vector2.new(0,y),.05) p.Color = Color3.fromRGB(255,0,0) p.Position = p.Position+(Vector3.zAxis/(1/res)) table.insert(parts,p) end for x=-range*1.5,range*1.5,.05 do local p = createPart(Vector2.new(x,0),.05) p.Color = Color3.fromRGB(0,0,255) p.Position = p.Position+(Vector3.zAxis/(1/res)) table.insert(parts,p) end rend() -- end owner.Chatted:Connect(function(w) local s = w:split(" ") if s[1]=="/e" or s[1]=="/emote" then table.remove(s,1) end if s[1]:sub(1,2)~="f/" then return end if s[1]=="f/reset" then reset() elseif s[1]=="f/graph" then local ff,err = loadstring("local x,y=(...).X,(...).Y;return "..table.concat(s,' ',2)) if ff==nil then return print('err',err) end draw(ff) elseif s[1]=="f/equal" then local ff,err = loadstring("local x,y=(...).X,(...).Y;return y == ("..table.concat(s,' ',2)..")") if ff==nil then return print('err',err) end draw(ff) elseif s[1]:sub(1,6)=="f/set/" then if s[1]:sub(7)=="res" then local n = tonumber(s[2]) if n then res=n;print('set res') else print('failed tonumber') end elseif s[1]:sub(7)=="range" then local n = tonumber(s[2]) if n then range=n;print('set range') else print('failed tonumber') end end end end)